package com.unsiv.helicopter.entity;

import org.anddev.andengine.entity.sprite.AnimatedSprite;
import org.anddev.andengine.input.touch.TouchEvent;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

/**
 * 
 * @author fanzhen
 * @time 5:10:25 PM Nov 1, 2011
 * @email fanzhen.meng@gmail.com
 * @qq 474146502
 * @phone 18660809423
 */
public class AdjustmentLeft extends AnimatedSprite {
	private OnLeftClickListener onLeftClickListener;

	public AdjustmentLeft(float pX, float pY,
			TiledTextureRegion pTiledTextureRegion) {
		super(pX, pY, pTiledTextureRegion);
	}

	@Override
	public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
			float pTouchAreaLocalX, float pTouchAreaLocalY) {
		super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX,
				pTouchAreaLocalY);
		switch (pSceneTouchEvent.getAction()) {
		case TouchEvent.ACTION_DOWN:
			if (this.onLeftClickListener != null)
				this.onLeftClickListener.onLeftClick();
		}
		return true;
	}

	public void changeBright() {
		this.setCurrentTileIndex(1);
	}

	public void changeBlack() {
		this.setCurrentTileIndex(0);
	}

	public interface OnLeftClickListener {
		public void onLeftClick();
	}

	public void setOnLeftClickListener(OnLeftClickListener onLeftClickListener) {
		this.onLeftClickListener = onLeftClickListener;
	}
}
